<template>
	<view class=" ">
		<view class="bg-white  p-10">
			<scroll-view scroll-y="true" class="scroll-Y">
				<view class="p-t-10 p-b-10">
					<view class="banmi_flex a-c" style="flex-wrap: wrap;">
						<view class="m-5 banmi_flex a-c">
							<text class="f-14 ">管理员:</text>
							<uni-data-select style="width: 120px;" class="m-l-10" @change="change_status" :clear="false"
								:value="status" :localdata="localdata_status">
							</uni-data-select>
						</view>

						<view class="m-5">
							<button @click="on_search" type="primary" size="mini">查询</button>
						</view>

						<view class="m-5">
							<button @click="on_search_resetting" style="background-color: #C0C0C0;" type="primary"
								size="mini">重置</button>
						</view>


					</view>
				</view>


				<uni-table style="min-height: 72vh;" border stripe type="selection" class="m-5" :type="'2'"
					@selection-change="selectionData">
					<uni-tr>

						<uni-th align="center">IP</uni-th>
						<uni-th align="center">管理员id</uni-th>
						<uni-th align="center">登录时间</uni-th>
						<uni-th align="center">设备信息</uni-th>
					</uni-tr>

					<uni-tr v-for="(vo,index) in list" :key="index">

						<uni-td align="center">
							{{vo.ip}}

						</uni-td>
						<uni-td align="center">
							{{vo.admin_uid}}
						</uni-td>
						<uni-td align="center">
							{{vo.time|getTime}}
						</uni-td>
						<uni-td align="center">
							{{vo.banmi_uniPlatform}};{{vo.banmi_model}};{{vo.banmi_browserName}}
						</uni-td>


					</uni-tr>
				</uni-table>

				<view class="p-10">
					<uni-pagination @change="getPage" show-icon="true" :total="total" current="1"
						style="float: left;margin-bottom: 10px;"></uni-pagination>

				</view>
			</scroll-view>
		</view>


	</view>
</template>

<script>
	export default {
		components: {


		},
		data() {
			return {
				list: [],
				last_page: 0,
				total: 0,
				page: 1,
				day: "",
				status: 0,

				localdata_status: [],
			}
		},
		onLoad() {
			this.adminid = "";
			this.page = 1;
			this.init();
			this.admininit()
		},
		methods: {


			change_status(val) {
				this.adminid = val

			},


			on_search() {

				this.page = 1;
				this.init();
			},
			on_search_resetting() {
				this.adminid = "";
				this.page = 1;
				this.init();
			},
			getPage(id) {
				this.page = id.current;
				this.init()
			},
			async init() {
				let requestParams = {
					page: this.page,
					adminid: this.adminid
				};
				const ret = await this.Banmikeji.admin_login_log(requestParams);

				this.list = ret.data.list.data;
				this.total = ret.data.list.total;

			},
			async admininit() {
				var that = this;
				let requestParams = {};
				const ret = await this.Banmikeji.role_role_list(requestParams);
				if (ret.status == 200) {
					this.lista = ret.data.list.data;

					for (var i = 0; i < this.lista.length; i++) {
						var find = {
							"value": this.lista[i]["id"],
							"text": this.lista[i]["nickname"],
						}
						this.localdata_status.push(find)
					}
				}
			},
		}
	}
</script>

<style>
	button {
		padding: 5rpx 10rpx;
	}

	button::after {
		border: none;
		background-color: none;

	}

	.operate_right {
		position: sticky;
		right: 0;
		z-index: 100;
		background-color: #fff;
	}

	.m-5 {
		margin: 5px;
	}

	.page_Selected {
		background-color: #007aff;
		width: 30px;
		height: 25px;
		border-radius: 5px;
		color: #fff;
	}

	.Nopage_Selected {
		background-color: #fff;
		width: 30px;
		height: 25px;
		border-radius: 5px;
		color: #000;
	}
</style>